package org.lds.scheduled.job.worker.endpoint;

import lombok.RequiredArgsConstructor;
import org.lds.scheduled.job.common.model.dto.ResultDTO;
import org.lds.scheduled.job.common.model.request.AddJobRequest;
import org.lds.scheduled.job.common.model.request.RemoveJobRequest;
import org.lds.scheduled.job.worker.service.ReceiveJobService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/job")
public class ReceiveJobEndpoint {
    private final ReceiveJobService receiveJobService;

    @PostMapping("/add")
    public ResultDTO addJob(@RequestBody AddJobRequest request) {
        return receiveJobService.addJob(request);
    }

    @PostMapping("/remove")
    public ResultDTO removeJob(@RequestBody RemoveJobRequest request) {
        return receiveJobService.removeJob(request);
    }

}
